<form class="layui-form" action="">
    <input name="emId" id="emId1" type="hidden" />
    <input name="emPid" id="emPid1" type="hidden" />

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">父级菜单:</label>
            <div class="layui-input-inline">
                <input type="text" name="emParentName1" id="emParentName1" lay-filter="tree" placeholder="父级菜单(不选为顶级)"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">菜单名称:</label>
            <div class="layui-input-inline">
                <input type="text" name="emName" id="emName1" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <!--<label class="layui-form-label">菜单类型:</label>
            <div class="layui-input-block">
                <input type="radio" name="emType" id="emType0" value="0" title="菜单">
                <input type="radio" name="emType" id="emType1" value="1" title="按钮">
            </div>-->

            <label class="layui-form-label">菜单类型:</label>
            <div class="layui-input-inline">
                <select name="emType" id="emType1">
                    <option value="0" selected="selected">菜单</option>
                    <option value="1">按钮</option>
                    <option value="2">功能</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">权限标识:</label>
            <div class="layui-input-inline">
                <input type="text" name="emMark" id="emMark1" placeholder="请选填写权限标识" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">是否可见:</label>
            <div class="layui-input-inline">
                <select name="emVisible" id="emVisible1">
                    <option value="1" selected="selected">可见</option>
                    <option value="0">不可见</option>
                </select>
            </div>

            <!--<label class="layui-form-label">是否可见:</label>
            <div class="layui-input-inline">
                <input type="text" name="emVisible" id="emVisible1" autocomplete="off" class="layui-input">
            </div>-->
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">图标:</label>
            <div class="layui-input-inline">
                <input type="text" name="emIcon" id="emIcon1" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">新窗口打开:</label>
            <div class="layui-input-inline">
                <select name="emBlank" id="emBlank1">
                    <option value="1" selected="selected">是</option>
                    <option value="0">否</option>
                </select>
            </div>

            <!--<label class="layui-form-label">新窗口打开:</label>
            <div class="layui-input-inline">
                <input type="text" name="emBlank" id="emBlank1" autocomplete="off" class="layui-input">
            </div>-->
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">菜单链接:</label>
            <div class="layui-input-inline">
                <input type="text" name="emLink" id="emLink1" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">排序号:</label>
            <div class="layui-input-inline">
                <input type="text" name="emSort" id="emSort1" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">备注:</label>
            <div class="layui-input-inline">
                <input type="text" name="emRemark" id="emRemark1" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

</form>

<script type="text/javascript">

    $(function(){
        var data = $('#page-com').data('menuData');
        //console.log(data);
        if (data != null){
            document.getElementById("emId1").value= data.id;
            document.getElementById("emPid1").value= data.parentId;
            document.getElementById("emParentName1").value= data.parentName;
            document.getElementById("emName1").value= data.name;

            // 下拉框类型
            $("#emType1 option[value='" + data.menuType + "']").attr("selected", "selected");

            document.getElementById("emMark1").value= data.pmMark;

            //document.getElementById("emVisible1").value= data.visible;
            $("#emVisible1 option[value='" + data.visible + "']").attr("selected", "selected");

            document.getElementById("emIcon1").value= data.icon;

            //document.getElementById("emBlank1").value= data.blank;
            $("#emBlank1 option[value='" + data.blank + "']").attr("selected", "selected");

            document.getElementById("emLink1").value= data.url;
            document.getElementById("emSort1").value= data.orderNum;
            document.getElementById("emRemark1").value= data.remark;

            $('#page-com').data('menuData',null);
        }


        layui.use('form', function(){
            var form = layui.form;
            //form.render('radio');
            form.render('select');
        });
    })


    $(document.body).on('click', '#emParentName1', function () {
        layui.use('layer', function() {
            var $ = layui.jquery, layer = layui.layer;

            var layId = layer.open({
                title:'请选择菜单',
                id: 'LAY_layuipro',//设定一个id，防止重复弹出
                type: 1,
                area: ['300px', '400px'],
                shadeClose: true,
                closeBtn: 0,
                content: getHtml('/sys/menu/tree.html')
            });

            $('#winLayId').attr('layId',layId);
        });
    });




</script>